<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <!-- import CSS -->
    <link rel="stylesheet" href="../static/css/element.css">
</head>
<body>
    <div id="app">
        <el-dialog
                title="登录"
                :visible.sync="dialogVisible"
                width="30%">
            <el-input placeholder="请输入账号" v-model="loginData.username" clearable> </el-input>
            <br/><br/>
            <el-input placeholder="请输入密码" v-model="loginData.password" show-password></el-input>
            <br/>
            <span id="errormsg" style="color: red"></span>
            <span slot="footer" class="dialog-footer">
                <el-button @click="dialogVisible = false">取 消</el-button>
                <el-button type="primary" @click="login()">登 录</el-button>
            </span>
        </el-dialog>
    </div>


</body>
<script type="text/javascript" src="../static/js/jquery.min.js"></script>
<script type="text/javascript" src="../static/js/vue.min.js"></script>
<script type="text/javascript" src="../static/js/vue-resource.min.js"></script>
<script type="text/javascript" src="../static/js/element.js"></script>

<script>
    new Vue({
        el: '#app',
        data: {
            dialogVisible: false,
            loginData: {  /**登录信息*/
                username: "",
                password: "",
            },
        },
        created() {
            this.dialogVisible = true;
        },
        methods: {
            login:function(){
                //发送 post 请求
                this.$http.post('/login/login',this.loginData).then(function(res) {
                    debugger
                    if (res.bodyText === "success") {
                        this.dialogVisible = false;
                        //打开信息页面
                        window.location.href = ("/jump/html?html=frpcInfo");
                    }else{
                        $("#errormsg")[0].innerText = res.bodyText;
                    }
                },function(res){
                    console.log(res.status);
                });
            },
        }
    })

</script>

</html>